package br.com.app.view.form
{
	
	import Formularios.FormBase;
	import Formularios.FormConteudo;
	import Formularios.FormFreqLancadas;
	import Formularios.FormLancaConteudo;
	import Formularios.FormLancaFreq;
	import Formularios.FormLancaFreqMes;
	import Formularios.FormLancaNotas;
	import Formularios.FormLogin;
	import Formularios.FormMPI;
	import Formularios.FormNotasLancadas;
	import Formularios.FormPeriodo;
	import Formularios.FormPrint;
	import Formularios.FormTrocaSenha;
	
	import mx.controls.Alert;
	import mx.core.Container;
	import mx.managers.PopUpManager;
	
	public class AppForm
	{
		
		public static function Open(window:Container, 
									formToOpen:String,
									data:Object=null):void
		{
			var formBaseToOpen: FormBase;
			
			//aqui faremos um switch oara instaciar diversos forms
			switch(formToOpen){
				// LOGIN
				case "FormLogin":
					formBaseToOpen = FormLogin(PopUpManager.createPopUp(window,FormLogin,true));
					break;
				case "FormPeriodo":
					formBaseToOpen = FormPeriodo(PopUpManager.createPopUp(window,FormPeriodo,true));
					break;
				case "FormLancaNotas":
					formBaseToOpen = FormLancaNotas(PopUpManager.createPopUp(window,FormLancaNotas,true));
					break;					
				case "FormLancaFreq":
					formBaseToOpen = FormLancaFreq(PopUpManager.createPopUp(window,FormLancaFreq,true));
					break;
				case "FormNotasLancadas":
					formBaseToOpen = FormNotasLancadas(PopUpManager.createPopUp(window,FormNotasLancadas,true));
					break;
				case "FormTrocaSenha":
					formBaseToOpen = FormTrocaSenha(PopUpManager.createPopUp(window,FormTrocaSenha,true));
					break;						
				case "FormFreqLancadas":
					formBaseToOpen = FormFreqLancadas(PopUpManager.createPopUp(window,FormFreqLancadas,true));
					break;				
				case "FormLancaFreqMes":
					formBaseToOpen = FormLancaFreqMes(PopUpManager.createPopUp(window, FormLancaFreqMes, true));
					break;
				case "FormConteudo":
					formBaseToOpen = FormConteudo(PopUpManager.createPopUp(window, FormConteudo, true));
					break;
				case "FormLancaConteudo":
					formBaseToOpen = FormLancaConteudo(PopUpManager.createPopUp(window, FormLancaConteudo, true));
					break;
					
				case "FormMPI":
					formBaseToOpen = FormMPI(PopUpManager.createPopUp(window, FormMPI, true));
					break;	
					
				case "FormPrint":
                    formBaseToOpen = FormPrint(PopUpManager.createPopUp(window, FormPrint, true));
                    break;  				
				// mais...
				
				default:
					mx.controls.Alert.show("Formlário não encontrado.");
					return;
					break;
			}
			
			formBaseToOpen.objectData = data;
			PopUpManager.centerPopUp(formBaseToOpen);
		}
		
		public function AppForm()
		{
		}

	}
}